package com.xbs.controller.hitchhiking;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xbs.controller.base.BaseServlet;
import com.xbs.entity.EmployeeEntity;
import com.xbs.service.hitchhiking.EmpAdminService;

/**
 * 添加员工的servlet
 * @author dell
 */
@WebServlet("/backstage/addemp")
public class AddEmpServlet extends BaseServlet{
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	/**
	 * 向员工表插入一条数据
	 */
	EmpAdminService emp = new EmpAdminService();
	
	EmployeeEntity employee = new EmployeeEntity();
	employee.setEmpidcard(req.getParameter("sfz"));
	employee.setEmpinput(req.getParameter("lrr"));
	employee.setEmpname(req.getParameter("ygxm"));
	employee.setEmprole(req.getParameter("js"));
	employee.setEmpsex(req.getParameter("xb"));
	employee.setEmpstatus(req.getParameter("zt"));
	employee.setEmpstore(req.getParameter("szmd"));
	employee.setEmptel(req.getParameter("dh"));
	int emprow = emp.insertEmployee(employee);
	
	
	redirect("/backstage/employee");
	
}

@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	doPost(req, resp);
	}
}
